Digital scanners are commonly used to capture images from hardcopy media. In a typical scanning operation, the surface of an original document is illuminated as an image sensor moves past the document detecting the intensity of light reflected from each location. These analog light intensity values are subsequently stored at corresponding pixel locations as proportionate electrical charges, which are collectively passed to an image processor where they are quantized to grayscale levels. Each grayscale level is represented by a multi-bit digital value that has a number of bits that is determined by the number of intensity levels that can be generated by the scanner. For example, in a scanner that represents grayscale levels using 8 bit words will be able to capture 256 (28) different intensity levels. The grayscale value for the level that provides the closest match to the intensity of light reflected from each location is assigned to the corresponding pixel. Thus, scanning captures analog input images by generating a stream of multi-bit values, with each location in the image being represented by a multi-bit digital word.
One or more scanners, printers, video displays and/or computer storage devices are often connected via a communications network to provide a digital reproduction system. For example, a digital copier may incorporate a scanner and a digital printer. While scanners capture hundreds of light intensity levels, digital output devices usually generate relatively few levels of output. For example, digital printers typically process binary output, for which a single bit is assigned to each pixel. During printing, marking material is either applied to or withheld from the pixel depending upon the assigned value. In a system with a digital printer and scanner, the grayscale data generated by the image capture device is usually rendered to binary format and stored in memory, from which it is subsequently retrieved by the output device. While it is possible to print data as it is rendered, storing it first provides several advantages. For one, when the data is stored, it is possible to print multiple copies of the same page without having to repeatedly re-scan the original document. It is also easier to transfer stored data between devices, as it can be compressed and decompressed.
Grayscale image data is often processed for improved image quality. In order to avoid data loss, image processing is preferably applied before the image is rendered. Well known image processing techniques are performed to improve image contrast, sharpness and color, to eliminate scanning artifacts, hole punches and other undesirable data and for many other reasons. For example, “skew” may be exhibited in an output image captured from an original document that became rotated relative to the image sensor before it was captured.
Skewed images are unappealing to the viewer and it is difficult to process skewed images in optical character recognition processes. Skew correction is a well known imaging process that may be applied to eliminate skew from a digital image. Since the contents of an image are viewed in relation to the edges of the page on which it is printed, known methods of eliminating skew include aligning the image with the edge of the document. More specifically, skew can be eliminated by determining the magnitude and direction of the document rotation relative to a document edge and applying a corresponding counter rotation to the image data. Most systems that digitally reproduce images use mechanical systems to properly align the document as it is transported to the scanning area. While mechanical systems and methods are useful, they cannot typically eliminate all of the skew from the document before it is placed on the scanning surface. As such, electronic systems and methods are employed to apply the fine tuning that is required to eliminate the remaining skew.
An accurate and robust digital image processing technique analyzes the entire scan to select the data that is most relevant for processing. Notably, each line in a skewed image straddles several more scanlines than its properly aligned counterpart. As electronic skew correction requires the storage of all of the data that will be processed during skew angle detection, skewed images include more data and therefore, require additional storage space and skew correction requires additional processing time. Many skew correction techniques store all of the data that will be processed by simply storing the entire image. Other techniques perform a preliminary analysis of the image and store a subset of the image data that is selected based upon the outcome of certain assumptions.
One-pass scanners process image data “on-the-fly,” i.e., the grayscale data is generated, processed and rendered in real-time. Since it is generally too expensive to store all of the grayscale image data for an entire scan (i.e., multi-bit grayscale values for every pixel in the image) at a rate that is fast enough to keep pace with the scanning rate, one-pass scanners almost always store only a subset of the scanned data. Known processes calculate skew angle using the top edge of a document to detect transitions between the background (no document) and the document in the fast scan direction. While these approaches have proven useful, they are often prone to errors due to their sensitivity to noise. They also tend to require relatively complex logic in order to process the data that is collected for the skew angle determination.
It is therefore, beneficial to provide a system and method for processing a grayscale image in real-time to detect the skew angle in a digital image. In one aspect, it is advantageous to calculate skew based upon background to medium transitions found at the leading edge of the document